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

Query time 0.00045