UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TlGs2ZqoF+Ch9MS0a9Y0vCrzzzITQEA1JSNcLhf6Flc=' 
WHERE 
  key_id = 'c6138b63aa381274bdd15422f24956d3e65a416fa1368abd4ab3ec3ae3e992ec' 
  AND (
    token = 'TlGs2ZqoF+Ch9MS0a9Y0vCrzzzITQEA1JSNcLhf6Flc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033