UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8dlYi5Qwmw0dfW8N6VrSU3sDqcCFnYK1yoXMeifPJS8=' 
WHERE 
  key_id = '7820d93eaeafdd452f3c4bbdaee17fda16c92adecfc8a368952d0d4cb29da55a' 
  AND (
    token = '8dlYi5Qwmw0dfW8N6VrSU3sDqcCFnYK1yoXMeifPJS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046