UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbh+OBun3AXQY1Jlx0fprYZKfh+xaKwhu9TFY6cMfFg=' 
WHERE 
  key_id = '13cc98d08eaeca66875cbaf1318f2204d96e39d120de121998a90cc229cdf689' 
  AND (
    token = 'dbh+OBun3AXQY1Jlx0fprYZKfh+xaKwhu9TFY6cMfFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034