UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L6v6MvWX0G5dv1hwPzIf2UdyzDaadYT3wOrlYbjsvZ0=' 
WHERE 
  key_id = '2747d244108436d7a6b1bd6c750c128607d3a3a95db2a2a1fcc1aff8df4f4481' 
  AND (
    token = 'L6v6MvWX0G5dv1hwPzIf2UdyzDaadYT3wOrlYbjsvZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031