UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AcfnA1izW80c/25UferTHJCyMZQB/8JdxophYGDRyXA=' 
WHERE 
  key_id = 'dcb9d23e99a52f25e6bb3a68a8073b25aea723a6be4b9863e4451f0980e8809d' 
  AND (
    token = 'AcfnA1izW80c/25UferTHJCyMZQB/8JdxophYGDRyXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039