UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YHaQiN4Rbn7A2QuuVQ/82jm4szntgVguG9bLUg6Zib0=' 
WHERE 
  key_id = '99b121ef83f9e1ce5bc4a27d894f270be3a64d6cdc87a1ccf9e5093899bc2a32' 
  AND (
    token = 'YHaQiN4Rbn7A2QuuVQ/82jm4szntgVguG9bLUg6Zib0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043