UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvYMFlxF6NIxnG7OXcPh0TEyF6EmSaHqEJ8TjDPAe0Y=' 
WHERE 
  key_id = 'fe33a2fe87eb598b739524de3f89832a37534e144345233b5794ddf101cf5198' 
  AND (
    token = 'kvYMFlxF6NIxnG7OXcPh0TEyF6EmSaHqEJ8TjDPAe0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036