UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pMzJHWZqT0ZJgn/QAakU50bZwokeHN3dwYzZfUdrVOw=' 
WHERE 
  key_id = '4fcae1df851842d8f9b9b63339fa364dee574de7f57237ea7adb6b15fbea7c28' 
  AND (
    token = 'pMzJHWZqT0ZJgn/QAakU50bZwokeHN3dwYzZfUdrVOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034