UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'as8Uj+8V85ga1sxVYGTkFHJ8IkN8dajpuPrBRhLFiGc=' 
WHERE 
  key_id = '031842e9ee6879c0d830ba51a754aaf6ca3b48b9880f904eb00416b0ac2234c5' 
  AND (
    token = 'as8Uj+8V85ga1sxVYGTkFHJ8IkN8dajpuPrBRhLFiGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033