UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lv0FMd6fOEdXn+RXUEb0zZePkZKd5+SZbTMf4lgh/e0=' 
WHERE 
  key_id = '65009bc07a5df25384f0ea91660431736425ade0dfbb2675b5a4542f10af9765' 
  AND (
    token = 'lv0FMd6fOEdXn+RXUEb0zZePkZKd5+SZbTMf4lgh/e0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038