UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mlzriONEfW2Toi2+F0uKNnR53S2d0PlxtOEgQlSNewE=' 
WHERE 
  key_id = '34d38e71c1a85a342c1a7afb0a6826eff520ac804d2b61daa7ea15af3a91b27b' 
  AND (
    token = 'mlzriONEfW2Toi2+F0uKNnR53S2d0PlxtOEgQlSNewE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027