UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qe2C7wi++0UT5JGjJ3ZjIucEwwy9Nub4pj0PKnRixAg=' 
WHERE 
  key_id = '24adfb901e3aa02f0d0df066bf0115f05a1cb5e8039dbdcb7dcbdd74ffa58e99' 
  AND (
    token = 'qe2C7wi++0UT5JGjJ3ZjIucEwwy9Nub4pj0PKnRixAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042