UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cWywW+6XVFrDDRWOFV6Os7yOWCVf8+gRPiOvvnZPWi4=' 
WHERE 
  key_id = '39bc51bb130c3f2b23eff7da9812b2253a2c6561773e2b72771c2b0bc707afdf' 
  AND (
    token = 'cWywW+6XVFrDDRWOFV6Os7yOWCVf8+gRPiOvvnZPWi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047