UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3SqMQTpa5NCrowGza0dMXWOerre+0jTsuCKY6POe918=' 
WHERE 
  key_id = '7d5e010602912066ee491ba1a539058fe5ffd31b72b47589575ca2701929c414' 
  AND (
    token = '3SqMQTpa5NCrowGza0dMXWOerre+0jTsuCKY6POe918=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016