UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jQrb70b0pCwDpyl1G90Wi+RluMP6jRBBHgWriVl8+DI=' 
WHERE 
  key_id = 'a47676c430a69f005094db93f4a000121f07467b5e87e6d36933a8d671f5fd42' 
  AND (
    token = 'jQrb70b0pCwDpyl1G90Wi+RluMP6jRBBHgWriVl8+DI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040