UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dG6Yas1+pOWyiyT23DE+n9sPjIbkXgKtAZfCt5zMStU=' 
WHERE 
  key_id = '0d76de58caf33e81eef5f116f0f143b320122327a0eb010b5d2870972f4c35aa' 
  AND (
    token = 'dG6Yas1+pOWyiyT23DE+n9sPjIbkXgKtAZfCt5zMStU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028