UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/dEBHLNnCjd0xAl+v4d9OoWDYuEX8c+RjgMQDCfe9eQ=' 
WHERE 
  key_id = '1e70e4481f186388661670442fb745ef3d9f32a7fd9e3f7d4c21a12ee702c14d' 
  AND (
    token = '/dEBHLNnCjd0xAl+v4d9OoWDYuEX8c+RjgMQDCfe9eQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053