UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tIbG7HEPPe97XoOFmjEochsF+SGZ8qy1ysvebguA/4E=' 
WHERE 
  key_id = '96d0451beea2f61fd079bfd3698b4012f448ef618c0976e4d8768936f8841600' 
  AND (
    token = 'tIbG7HEPPe97XoOFmjEochsF+SGZ8qy1ysvebguA/4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031