UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jGPwB9qowu0oiviZhT1Th1mdJaraKxVL5tdYfQyUw58=' 
WHERE 
  key_id = 'ee794b827c5451824acf9a1719903bdfec584172da416b7089029e4fefc1ad05' 
  AND (
    token = 'jGPwB9qowu0oiviZhT1Th1mdJaraKxVL5tdYfQyUw58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043