UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gKvqA98tAzbChlaMPc6s6TMvNobMq26NcnaSdaFZWTc=' 
WHERE 
  key_id = '43773de49a74c6970e2e249db7962c940cbf59f976cd2c97c98fb6aad73ec202' 
  AND (
    token = 'gKvqA98tAzbChlaMPc6s6TMvNobMq26NcnaSdaFZWTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036