UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xn4Do/Cb1q+PgbsyzFWfs5/dXxVj6DeMur25skHPP7c=' 
WHERE 
  key_id = '250bc06f983268f88ccce81ee087c8d917d4300acd6d650eb78e9646d77b10d2' 
  AND (
    token = 'xn4Do/Cb1q+PgbsyzFWfs5/dXxVj6DeMur25skHPP7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019