UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hd3BI+xTIf4LJLjkWnHRW8HQUFLQTbPKLcmON7ncyxI=' 
WHERE 
  key_id = 'bff4d0f3dc6c8428db2b7c26d2102895d147f010ba9cf371fff37c6123833701' 
  AND (
    token = 'hd3BI+xTIf4LJLjkWnHRW8HQUFLQTbPKLcmON7ncyxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032