UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OkbXpKEluHrK82nICe0G5tdBVeNH4aLvy+AJ9BrBIyA=' 
WHERE 
  key_id = '3fa1de797b720d7f06da24109aed958def4cc88148787d67d3ce91b18f22f34b' 
  AND (
    token = 'OkbXpKEluHrK82nICe0G5tdBVeNH4aLvy+AJ9BrBIyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045