UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CR50dOWhurqE5wF8VmVuKcPVSax03aziEoyYaQzdOJo=' 
WHERE 
  key_id = '9793be699f16ebde8c73a7f23cdfbc2fa60c88c524bc6fb8f7b2d69e9cfc808e' 
  AND (
    token = 'CR50dOWhurqE5wF8VmVuKcPVSax03aziEoyYaQzdOJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017