UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IadonF7SD1Ap0VZlOXD3OPB9QTj7qiU2Q+pYl+76EOE=' 
WHERE 
  key_id = '24af4f4303a9a866d5c14425431d0a734ce16ff410edc0d4acbbcffe132d0f48' 
  AND (
    token = 'IadonF7SD1Ap0VZlOXD3OPB9QTj7qiU2Q+pYl+76EOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036