UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd6qcIXYhu0eSOeziEGq/V6skZT8FWTGtxVcRNZTAmyg=' 
WHERE 
  key_id = '368e392dc1ca4ae41b1ec01578b5343ec33db866f53dfab2b3e501ee3b17091e' 
  AND (
    token = 'd6qcIXYhu0eSOeziEGq/V6skZT8FWTGtxVcRNZTAmyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028