UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mdNOpqA2266p168uPTvncFx23LcQNULeKXQrmpIRy+c=' 
WHERE 
  key_id = '297e79ab1a83619310d3e10b79d2695cd3dd1b4d054064709ac44c0c8bf14b96' 
  AND (
    token = 'mdNOpqA2266p168uPTvncFx23LcQNULeKXQrmpIRy+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015