UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sNhINmM0xRLq8RY+QWlqdtoE9I6V+1dWSL7+vNscTcc=' 
WHERE 
  key_id = '374feb493abc7b3d977b2db2db3ce1763940d478b0d99b8a75d41c6662a24b3d' 
  AND (
    token = 'sNhINmM0xRLq8RY+QWlqdtoE9I6V+1dWSL7+vNscTcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037