UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'agxS19njtHkI6wlkUPsCkziASJhN8AV0Vzjkhrr5FfQ=' 
WHERE 
  key_id = 'a9b39dd53493211c6415d8946490fc78b3942264ff4cb37a14f534470977cbfd' 
  AND (
    token = 'agxS19njtHkI6wlkUPsCkziASJhN8AV0Vzjkhrr5FfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023