UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9NTc+8vJF0gfACcgQOWCx8WXRrgf6BEcpalSG6ywpEk=' 
WHERE 
  key_id = '46f373d31ed2d8230e3c04e9564c22765ae72f12f5feda6d3498d0e8c17b9ebc' 
  AND (
    token = '9NTc+8vJF0gfACcgQOWCx8WXRrgf6BEcpalSG6ywpEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036