UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WOAManNCzlyiFLYJKxQ6afZh5zCvXiivTlp1BvDfQzs=' 
WHERE 
  key_id = '4aa67d6e6eaf0edfa3d38d2c7638a43646cf88e54d4e9c98f153154c27d15b14' 
  AND (
    token = 'WOAManNCzlyiFLYJKxQ6afZh5zCvXiivTlp1BvDfQzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026