UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Z129E6KIb9fSard5WMVje+l3Rmmn4lcXkpis+OSV7c=' 
WHERE 
  key_id = 'd7cbb9e16e037f4e8e82b1aa1c99dc79d80cbc65cfe126778db713c2eae92faa' 
  AND (
    token = '0Z129E6KIb9fSard5WMVje+l3Rmmn4lcXkpis+OSV7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038