UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cZQhdvq0Ke87CVr21GFer791M+bY/q9Ly3987mG4C5M=' 
WHERE 
  key_id = '8f5d03740bfe2767c61c1b1c6e4f7becd8fffb43b015e36b57bacc71bc8c71a7' 
  AND (
    token = 'cZQhdvq0Ke87CVr21GFer791M+bY/q9Ly3987mG4C5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033