UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ahoRn+aTrv6WJYoGDEzWD9ZcBdWIdvhUs0G42ZJB6+8=' 
WHERE 
  key_id = '69089413e803a2f4e06f4010da79cc3600e70060e7464a442cdf576ede595f6f' 
  AND (
    token = 'ahoRn+aTrv6WJYoGDEzWD9ZcBdWIdvhUs0G42ZJB6+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030