UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iTJus3hlhjKAShZKe7Kwaity/Tbx/eAdFvWh/36uf00=' 
WHERE 
  key_id = '429a025fac3b27d9973d7f12b952830f565e49fbbca5e0a30414e193b95b55ae' 
  AND (
    token = 'iTJus3hlhjKAShZKe7Kwaity/Tbx/eAdFvWh/36uf00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031