UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zq4HgAUrQP9pxgXEmfSp0UdHAp0aVDNtW0GNEu5szhU=' 
WHERE 
  key_id = '6791d240a5a99d98da36ab55f59c37e3c7cfd4986754a52dd9a4c6b3578d7688' 
  AND (
    token = 'zq4HgAUrQP9pxgXEmfSp0UdHAp0aVDNtW0GNEu5szhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024