UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b0TUXDiWT6ItJ8TbS/10UWOLRi+Z/5+J+rX+uUUgfKM=' 
WHERE 
  key_id = '465168f1100ae5ffa3d3500fa1891891e4c35af6c5da82a70811126f57dd7f0a' 
  AND (
    token = 'b0TUXDiWT6ItJ8TbS/10UWOLRi+Z/5+J+rX+uUUgfKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042