UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BKZhsszdipnyrxD6BDzfOT578LNxewCY8y/c6NksyrI=' 
WHERE 
  key_id = '7b479a207f8a70b4bb6890cdb9bd953e3a5762294203cc8440f24d635831c074' 
  AND (
    token = 'BKZhsszdipnyrxD6BDzfOT578LNxewCY8y/c6NksyrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041