UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SG8+wcO4PgghnKB+0SA3og+yp6Q4jSjh7JSk/UvhYTQ=' 
WHERE 
  key_id = 'a191dbf9cf417b3d1e70a9c75f64c999968921bb36699c4b32f97d349fdf7aea' 
  AND (
    token = 'SG8+wcO4PgghnKB+0SA3og+yp6Q4jSjh7JSk/UvhYTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048