UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n1KSQEqoDispgCQXoWB0AdP9wOcljPcSedDTcAyM8Us=' 
WHERE 
  key_id = 'a2f536188613b004a87d7feb83bc49d96a8548af360f81b4821505ab10f91b3e' 
  AND (
    token = 'n1KSQEqoDispgCQXoWB0AdP9wOcljPcSedDTcAyM8Us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035