UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tm006ZFjwEuGHgri/iQ7bviaIJRYmaoq+fHELqsnXD0=' 
WHERE 
  key_id = '9c8cd374e2ce2078493059ba2d37611f6f23ea1d2141875a299fa7172efcb7ef' 
  AND (
    token = 'Tm006ZFjwEuGHgri/iQ7bviaIJRYmaoq+fHELqsnXD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032