UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q/16JoJaxCq5Bsm55WCyAUvZQxlKIi5YD2xa+QT9K/4=' 
WHERE 
  key_id = 'cc9167a30333060a74f5823c189d4df30f2622b2a40e41c911c29c98961d6527' 
  AND (
    token = 'q/16JoJaxCq5Bsm55WCyAUvZQxlKIi5YD2xa+QT9K/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029