UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iE1s6GfZ4+fOMIUWhU3mUMx7XcroIKEZ+Wl1C/Z1MHs=' 
WHERE 
  key_id = 'de729e40e60797d71d1f0a5515d1f27a861c93c59e48a7b8e19acd43975d34ee' 
  AND (
    token = 'iE1s6GfZ4+fOMIUWhU3mUMx7XcroIKEZ+Wl1C/Z1MHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035