UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dxhX695Gt02UPem7LxySk774ae6qKl/YLd1CB+8O58w=' 
WHERE 
  key_id = '40cd29a57d534d3d172c42949bfd41678df0fd3ab503ee5ebe6268f9a824c934' 
  AND (
    token = 'dxhX695Gt02UPem7LxySk774ae6qKl/YLd1CB+8O58w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077