UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dYXQbyYe/L9twnPz9436TBBY42QkMEj6AgvjqOZ+GQQ=' 
WHERE 
  key_id = '02c68788d108b41ac236a023b42f5fa38b7bc17aa9ad04fcf5ee2ad29e582d44' 
  AND (
    token = 'dYXQbyYe/L9twnPz9436TBBY42QkMEj6AgvjqOZ+GQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015